$(function () {
    new Typed($('.zddz')[0], {
        // 注意：输出的可以是标签，将标签当节点运行。比如下面的h2
        strings: [' 专注为客户 <i>创造价值.</i>'],
        typeSpeed: 80 // 速度
    });


    // 底部搜索
    // 获取滚动条超出范围
    function getScroll() {
        return {
            left: window.document.body.scrollLeft || window.document.documentElement.scrollLeft || window.pageXOffset || 0,
            top: window.document.body.scrollTop || window.document.documentElement.scrollTop || window.pageYOffset || 0
        };
    }
    //获取需要滚动的高度    这里需要改一下
    // let num = $('#page')[0].offsetHeight;
    let num = $('.banner')[0].offsetHeight + $('#fh5co-portfolio')[0].offsetHeight - $('#scsees')[0].offsetHeight;
    let num1 = $('.banner')[0].offsetHeight + $('#fh5co-portfolio')[0].offsetHeight;
    let num2 = $('.banner')[0].offsetHeight + $('#fh5co-portfolio')[0].offsetHeight + $('#scsees')[0].offsetHeight;
    let num4 = $('.banner')[0].offsetHeight - $('#fh5co-portfolio')[0].offsetHeight;
    let num3 = $('.banner')[0].offsetHeight;
    //   滚动事件
    window.onscroll = function () {
        if (getScroll().top >= num) {
            // jquery动画
            $('#scsees .fh5co-heading h2').animate({
                top: 0,
                opacity: 1
            }, 1200, function () {
                $('#scsees .fh5co-heading p').animate({
                    top: 0,
                    opacity: 1
                }, 800, function () {
                    $('.feature-center').animate({
                        top: 0,
                        opacity: 1
                    }, 600)

                })
            })
        };
        if (getScroll().top >= num1) {
            // jquery动画
            $('#fh5co-testimonial .fh5co-heading h2').animate({
                top: 0,
                opacity: 1
            }, 1200, function () {
                $('#fh5co-testimonial .fh5co-heading p').animate({
                    top: 0,
                    opacity: 1
                }, 800, function () {
                    $('.testimony').animate({
                        top: 0,
                        opacity: 1
                    }, 600)

                })
            })
        };
        if (getScroll().top >= num2) {
            // jquery动画
            $('.started_title h1').animate({
                top: 0,
                opacity: 1
            }, 1200, function () {
                $('.started_title p').animate({
                    top: 0,
                    opacity: 1
                }, 800, function () {
                    $('.started_search form').animate({
                        top: 0,
                        opacity: 1
                    }, 600)
                })
            })
        };
        if(getScroll().top>=num3){
            $('#fh5co-portfolio .pricing').animate({
                top:0,
                opacity:1
            },800)
        };
        if (getScroll().top >= num4) {
            $('#fh5co-portfolio h2').animate({
                top: 0,
                opacity: 1
            }, 1200, function () {
                $('#fh5co-portfolio p').animate({
                    top: 0,
                    opacity: 1
                }, 800)
                })
            }
        };
});